package com.mall.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mall.db.domain.Parameter;
import com.mall.db.service.ParameterService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/system/pc")
public class ParameterController extends BaseController<Parameter>{
    @Resource(name = "parameterService")
    private ParameterService ps;


    @Override
    public Map<String, Object> find(Parameter parameter) {
        Map<String,Object> map=new HashMap<>();
        QueryWrapper qw=new QueryWrapper();
        List<Parameter> list=ps.list(qw);
        map.put("code",0);
        map.put("data",list);
        return map;
    }

    @Override
    public Map<String, Object> add(Parameter parameter) {
        boolean b=ps.save(parameter);
        return this.iud("添加",b,parameter);
    }

    @Override
    public Map<String, Object> delete(Parameter parameter) {
        boolean b=ps.removeById(parameter.getId());
        return this.iud("删除",b,parameter);
    }
}
